import request from '@/utils/request.js'

// 获取帖子的所有评论
export const getPostCommentsService = (postId) => {
    return request.get('/comments/post/' + postId)
}

// 添加新评论
export const addCommentService = (commentData) => {
    return request.post('/comments/add', commentData)
}

// 删除评论
export const deleteCommentService = (commentId) => {
    return request.delete('/comments/delete/' + commentId)
}

// 点赞/取消点赞评论
export const likeCommentService = (commentId) => {
    return request.post('/comments/like/' + commentId)
}

// 检查用户是否点赞了某些评论
export const checkCommentsLikeStatusService = (commentIds, userId) => {
    return request.get('/comments/like/status', {
        params: {
            commentIds: commentIds.join(','),
            userId: userId
        }
    })
}

// 管理端获取所有评论
export const getAllCommentsService = () => {
    return request.get('/comments/admin/all')
}

// 管理端删除评论
export const deleteAdminCommentService = (id) => {
    return request.delete('/comments/admin/delete/' + id)
}

// 管理端批量删除评论
export const batchDeleteAdminCommentsService = (commentIds) => {
    return request.delete('/comments/admin/batch-delete', { data: { commentIds } })
}